package com.yangrong.thread.chapter1;

/**
 * 优雅的方式实现单例模式的懒加载（枚举方式）
 * 
 * @author YangRong
 * @date 2020年6月3日
 */
public class SingletonObject7 {

	private SingletonObject7() {

	}

	private enum Singleton {
		INSTANCE;

		private final SingletonObject7 instance;

		Singleton() {
			instance = new SingletonObject7();
		}

		public SingletonObject7 getInstance() {
			return instance;
		}
	}

	public static SingletonObject7 getInstance() {
		return Singleton.INSTANCE.getInstance();
	}

}
